# _*_ coding : utf-8 _*_
# @Time : 2023/3/17 0017 11:40
# @Author : 菜鸟王小二
# @File : 25_selenium定位
# @Project : python爬虫
import time

from selenium import webdriver
from selenium.webdriver.common.by import By
# 此处为chrome.service，不是common.service，别搞混
from selenium.webdriver.chrome.service import Service

path = Service('E:/chromedriver/chromedriver.exe')
driver = webdriver.Chrome(service=path)
driver.maximize_window()
driver.implicitly_wait(5)

driver.get('https://www.jd.com')
driver.find_element(By.ID, 'key').send_keys('安踏板鞋')

# driver.find_element(By.CSS_SELECTOR, '.button').click()
driver.find_element(By.XPATH,'//div[@id="search"]//button[@class="button"]').click()
time.sleep(3)


driver.quit()
